'''
# 全局变量
'''

from enum import Enum

class LexType(Enum) :
    ENDFILE = 1
    ERROR = 2
    PROGRAM = 3
    PROCEDURE = 4
    TYPE = 5
    VAR = 6
    IF = 7
    THEN = 8
    ELSE = 9
    FI = 10
    WHILE = 11
    DO = 12
    ENDWH = 13
    BEGIN = 14
    END = 15
    READ = 16
    WRITE = 17
    ARRAY = 18
    OF = 19
    RECORD = 20
    RETURN = 21
    INTEGER = 22
    CHAR = 23
    ID = 24
    INTC = 25
    ASSIGN = 26
    CHARC = 27
    LT = 28
    EQ = 29
    PLUS = 30
    MINUS = 31
    TIMES = 32
    OVER = 33
    LPAREN = 34
    RPAREN = 35
    DOT = 36
    COLON = 37
    SEMI = 38
    COMMA = 39
    LMIDPAREN = 40
    RMIDPAREN = 41
    UNDERANGE = 42
    DEFAULT = 43

class Token() :
    def __init__(self,line = 0,lex = LexType.DEFAULT,sem = None) :
        self.line = line
        self.lex = lex
        self.sem = sem

    def setLine(self,line) :
        self.line = line

    def setLex(self,lex) :
        self.lex = lex

    def setSem(self,sem) :
        self.sem = sem

    def toString(self) :
        if self.sem != None :
            return "<" + str(self.line) + "," + str(self.lex) + "," + str(self.sem) + ">"
        else :
            return "<" + str(self.line) + "," + str(self.lex) + ">"
